import http from "../utils/request"

//公告分页数据 /admin/notice/noticePage
const noticePage = (data = {}) => {
    return http.request({
        url: "/admin/notice/noticePage",
        method: 'get',
        data: data
    })
}

//新增公告信息 /admin/notice/addNotice
const addNotice = (data) => {
  return http.request({
    url: "/admin/notice/addNotice",
    method: 'post',
    data: data
  })
}

//公告详情 /admin/notice/{id}
const noticeInfo = (id) => {
    return http.request({
        url: "/admin/notice/" + id,
        method: 'get',
        data: {}
    })
}

//修改公告信息  /admin/notice/updateNotice
const updateNotice = (data) => {
    return http.request({
        url: "/admin/notice/updateNotice",
        method: 'post',
        data: data
    })
}

//删除公告信息 /admin/notice/{id}
const deleteNotice = (id) => {
    return http.request({
        url: "/admin/notice/" + id,
        method: 'delete',
        data: {}
    })
}

//修改状态 /admin/notice/{id}/{status}
const changeStatus = (id, status) => {
  return http.request({
    url: "/admin/notice/" + id + "/" + status,
    method: 'get',
    data: {}
  })
}

export {
  noticePage,
  addNotice,
  noticeInfo,
  updateNotice,
  deleteNotice,
  changeStatus
}
